package com.zeldu.teacher.controller;

import com.zeldu.common.model.response.CommonCode;
import com.zeldu.common.model.response.ResponseResult;
import com.zeldu.teacher.pojo.Teacher;
import com.zeldu.teacher.service.TeacherInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class TeacherInfoController {
    @Autowired(required = false)
    private TeacherInfoService teacherInfoService;

    @GetMapping("/getSelfInfo")
    public Teacher getSelfInfo(Long id) {
        return teacherInfoService.getSelfInfo(id);
    }

    @PostMapping("/mdfSelfInfo")
    public ResponseResult mdfSelfInfo(@RequestBody Teacher teacher) {
        if (teacherInfoService.mdfSelfInfo(teacher) != 0) {
            return new ResponseResult((CommonCode.SUCCESS));
        } else {
            return new ResponseResult((CommonCode.FAIL));
        }
    }
}
